<?php
 //Last Modified By DPT on May/25/05 to fix issues with HTML


  $partners=new partners;
  $partners->connection($host,$user,$pass,$db);

 #------------------------------------------------------------------------------
 # opens terms file
 # reads all contents
 #------------------------------------------------------------------------------
  $filename                = "admin/mer_terms.htm";
  $fp                      = fopen($filename,'r');
  $contents                = fread ($fp, filesize ($filename));
  fclose($fp);

  # geting records from table
  $sql ="select * from partners_paymentgateway where pay_status like 'Active' ";
  $ret =mysql_query($sql);

  # getting all currency from admin Panel

   $crnysql = " SELECT DISTINCT(currency_caption) FROM partners_currency ";
   $crnyret = mysql_query($crnysql) or die("You have an error while processing sql query ");


 $msg		=$_GET['msg'];
 $Action	=$_GET['Action'];

 if ($Action=="affiliate")     $aff="selected = 'selected' ";
 else                          $mer="selected = 'selected' ";
?>

<table width="775"  border="0" align="center" class="outtbl" cellpadding="0" cellspacing="0">
  <tr>
    <td width="215" align="left" valign="top" class="lftnavbg">
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="215" height="26" align="left" valign="top" class="lanbg"><table width="175"  border="0" cellspacing="0">
            <tr>
              <td width="215" align="right" valign="middle">
              <!-- Language: <select name="select2" class="style3">
                <option>English</option>
              </select>
			  -->
			  <? include_once "language_select.php"; ?>
			  </td>
            </tr>
          </table></td>
        </tr>
      </table>

        <table width="190"  border="0" cellspacing="0" cellpadding="15">
          <tr>
            <td width="215">
              <form name="login" action="login_validate.php" method="post">
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="1" colspan="2" bgcolor="#7D7D7D"></td>
                  </tr>
                  <tr>
                    <td height="25" colspan="2" ><div align="center"><img src="images/login.gif" width="111" height="17" alt="" /></div></td>
                  </tr>
                  <tr>
                    <td height="1" colspan="2" bgcolor="#7D7D7D"></td>
                  </tr>
                  <tr>
                    <td height="5" colspan="2" ><span class="style6">
                      <?=$Err?>
                    </span></td>
                  </tr>
                  <tr>
                    <td height="15" colspan="2" class="style5"><?=$lang_Choose?>
              :</td>
                  </tr>
                  <tr>
                    <td height="20" colspan="2" ><select name="flag" class="style3">
                        <option <?=$mer?> value="merchant">
                        <?=$lang_Merchants?>
                        </option>
                        <option <?=$aff?> value="affiliate">
                        <?=$lang_Affiliates?>
                        </option>
                    </select></td>
                  </tr>
                  <tr>
                    <td height="15" colspan="2" ><span class="style5">
                      <?=$lang_Username?>
              :</span></td>
                  </tr>
                  <tr>
                    <td height="20" colspan="2" ><input name="login" type="text" class="style3" value="" size="25" /></td>
                  </tr>
                  <tr>
                    <td height="15" colspan="2" class="style5"><?=$lang_Password?>
              :</td>
                  </tr>
                  <tr>
                    <td width="60%"><input  name="password" type="password" class="style3" value="" size="15"/></td>
                    <td width="60" height="20" class="enter"><div class="sbt" onclick="document.login.submit()" >&nbsp;&nbsp;&nbsp;&nbsp; Enter</div></td>
                  </tr>
                  <tr>
                    <td height="15" colspan="2" ><a href="#" onclick="viewLink()">
                      <?=$lang_Forgot?>
              ? </a></td>
                  </tr>
                  <tr>
                    <td height="5" colspan="2" ></td>
                  </tr>
                  <tr>
                    <td height="1" colspan="2" bgcolor="#7D7D7D"></td>
                  </tr>
                  <tr>
                    <td height="10" colspan="2" ></td>
                  </tr>
                  <tr>
                    <td height="10" colspan="2" ><div align="justify">
                        <?=$lang_iPartnersmanager?>
                    </div></td>
                  </tr>
                  <tr>
                    <td height="10" colspan="2" ></td>
                  </tr>
                  <tr>
                    <td height="1" colspan="2" bgcolor="#797979"></td>
                  </tr>
                </table>
            </form></td>
          </tr>
        </table></td>
    <td height="100%" rowspan="2" align="left" valign="top">
    <form method="post" name="reg" action="reg_validate.php?mode=insert">     <table width="95%" border="0" align="left" cellpadding="0" cellspacing="0">
        <tr bgcolor="#ffa200">
          <td width="5%" height="26" align="left" valign="top"> <img src="images/innerbox2_01.gif" width="24" height="26" alt=""/> </td>
          <td width="95%" align="center" valign="middle"> <div align="center" class="style4"><?=$MerchantRegistration?></div></td>
        </tr>
        <tr>
          <td height="280" colspan="2" class="ltrtbrdr1">
		  <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0"  class="tablewbdr" id="AutoNumber1" style="border-collapse: collapse">
            <tr>
              <td colspan="6" height="19" class="textred" align="center">
                <span class="style6"><?=$msg?> &nbsp;</span></td>
            </tr>
            <tr>
              <td width="1%" height="26">&nbsp;</td>
              <td width="14%" height="26"><span class="style6">*</span>                <?=$lang_FirstName?></td>
              <td width="35%" height="26">
                <input type="text" name="firstnametxt" size="20" value="<?=stripslashes($_GET['firstname'])?>" /></td>
                 <td width="14%" height="29"><span class="style6">*</span> <?=$lang_LastName?></td>
              <td width="35%" height="29">
                <input type="text" name="lastnametxt" size="20" value="<?=stripslashes($_GET['lastname'])?>"/></td>
              <!--                          -->
              <td width="1%" height="26">&nbsp;</td>
            </tr>
            <tr>
              <td width="1%" height="29">&nbsp;</td>
              <td width="18%" height="26"><span class="style6">*</span> <?=$lang_Category?></td>
             <td width="31%" height="26">
                <select size="1" name="categorylst">
                  <option selected='selected' value="nill"><?=$selectacategory?></option>
                 <?php
	                $sql    = "select * from partners_category";
	                $result = mysql_query($sql);
	            ?>
	                              <?php
	                while($row=mysql_fetch_object($result))
	                {
	                if($category==$row->cat_name)
	                {
	            ?>
	                              <option value="<?=$row->cat_name?>" selected="selected" >
	                              <?=$row->cat_name?>
	                              </option>
	                              <?php
	                    }
	                else{
	            ?>
	                              <option value="<?=$row->cat_name?>" >
	                              <?=$row->cat_name?>
	                              </option>
	                              <?php
	                         }
	                }
	            ?>
              </select></td>
               <td width="14%" height="31"><span class="style6">*</span> <?=$lang_Company?></td>
              <td width="35%" height="31">
                <input type="text" name="companytxt" size="20" value="<?=stripslashes($_GET['company']) ?>"/></td>
              <td width="1%" height="29">&nbsp;</td>
            </tr>
            <tr>
              <td width="1%" height="31">&nbsp;</td>
               <td width="14%" height="28"><span class="style6">*</span> <?=$lang_URL?></td>
              <td width="35%" height="28"><input type="text" name="urltxt" size="20" value="<?=stripslashes($_GET['url']) ?>" /></td>

              <td width="18%" height="31"><span class="style6">*</span> <?=$lang_Fax?></td>
              <td height="31"><input type="text" name="faxtxt" size="20" value="<?=stripslashes($_GET['fax'])?>"/></td>
              <td width="1%" height="31">&nbsp;</td>
            </tr>
            <tr>
              <td width="1%" height="28">&nbsp;</td>
               <td width="18%" height="29"><span class="style6">*</span> <?=$lang_Phone?></td>
              <td height="29"><input type="text" name="phonetxt" size="20" value="<?=stripslashes($_GET['phone'])?>"/></td>

              <td width="18%" height="28"><span class="style6">*</span> <?=$lang_EmailId?></td>
              <td height="28" ><input type="text" name="emailidtxt" size="20" value="<?=stripslashes($_GET['mailid'])?>" />
			</td>
              <td width="1%" height="28" valign="bottom">&nbsp;</td>
            </tr>
            <tr>
              <td width="1%" height="20">&nbsp;</td>
              <td width="14%" height="42" rowspan="2"><span class="style6">*</span> <?=$lang_Address?></td>
              <td width="35%" height="42" rowspan="2">
                <textarea rows="2" name="addresstxt" cols="20"><?=$_SESSION['MER_ADDRESS']?></textarea></td>
              <td width="18%" height="28"><span class="style6">*</span> <?=$lang_zip?></td>
              <td height="28" ><input type="text" name="ziptxt" size="20" value="<?=stripslashes($_GET['zip'])?>" /></td>
               <td width="1%" height="20">&nbsp;</td>
            </tr>
            <tr>
     			 <td width="1%" height="31">&nbsp;</td>

      			<td width="17%" height="31"><span class="style6">*</span> <?=$lang_City?></td>

      			<td width="32%" height="31" colspan="3">
      			<input type="text" name="citytxt" size="20" value="<?=stripslashes($_GET['city'])?>" />
     			</td>
     			 <td width="1%" height="31">&nbsp;</td>
    			</tr>

            <tr>
              <td width="1%" height="28">&nbsp;</td>
              <td width="14%" height="28"><span class="style6">*</span> <?=$lang_state?></td>
              <td width="35%" height="28"><input type="text" name="statetxt" size="20" value="<?=stripslashes($_GET['state']) ?>" /></td>
              <td width="14%" height="28"><span class="style6">*</span> <?=$lang_Country?></td>
              <td width="35%" height="28"><select size="1" name="countrylst">
                  <option value="nill" ><?=$lang_SelectaCountry?></option>
                  <?php
                    $sql    = "select * from partners_country";
                    $result = mysql_query($sql);
                ?>
                                  <?php
                    while($row=mysql_fetch_object($result))
                    {
                    if($country==$row->country_name)
                    {
                ?>
                                  <option value="<?=$row->country_name?>" selected >
                                  <?=$row->country_name?>
                                  </option>
                                  <?php
                        }
                    else{
                ?>
                                  <option value="<?=$row->country_name?>" >
                                  <?=$row->country_name?>
                                  </option>
                                  <?php
                             }
                    }
                ?>
              </select></td>
              <td width="1%" height="28">&nbsp;</td>
            </tr>
              <tr>
              <td width="1%" height="28">&nbsp;</td>
               <td width="18%" height="28"><span class="style6">* </span><?=$lang_taxId?></td>
              <td height="28"><input type="text" name="taxIdtxt" size="20" value="<?=stripslashes($_GET['taxId']) ?>" />
                </td>
               <td width="14%" height="19"><span class="style6">*</span> <?=$lang_Type?></td>
              <td width="35%" height="19"><select size="1" name="typelst">
                  <?
      if (trim($type)=="nill") {


       $nill="selected = 'selected'";

       }


       if (trim($type)==$lang_Advance) {


       $adv="selected = 'selected'";

       }

       if (trim($type)==$lang_Normal) {


       $nor="selected = 'selected'";

       }


       ?>
                  <option value="nill" <?= ($type=="nill" ? "selected" : "" ) ?>       ><?=$selectatype?></option>
                  <option value="advance" <?= ($type=="advance" ? "selected" : "" ) ?> ><?=$lang_Advance?></option>
                  <option value="normal"<?= ($type=="normal" ? "selected" : "" ) ?> ><?=$lang_Normal?></option>
              </select></td>




              <td width="1%" height="28" valign="bottom">&nbsp;</td>
            </tr>
            <tr>
              <td width="1%" height="19">&nbsp;</td>

              <td width="14%" height="19"><span class="style6">*</span><?=$lang_Payment?></td>
              <td width="35%" height="19"><select class="dropdown" name="modofpay">
                <?//checking for each records
               if(mysql_num_rows($ret)>0)
               {
                       while($row=mysql_fetch_object($ret))
                       {     if($modofpay==$row->pay_name) $sel="selected = 'selected'";
                             else                          $sel ="";
                             ?>
                <option  <?=$sel?>  value="<?=$row->pay_name?>">
                <?=$row->pay_name?>
                </option>
                <?

                        }
               }  ?>
              </select></td>

              <td width="18%" height="19"><?=$merreg_method?></td>
              <td height="28" valign="middle"> <input name="merchant_isInvoice" type="checkbox" value="Yes" class="bdrless" <?php echo ($merchant_isInvoice=="Yes")?"checked='checked'":"" ?> /> &nbsp;&nbsp;<?=$merreg_pay?>
             </td>
              <td width="1%" height="19"></td>
            </tr>
            <tr>
              <td width="1%" height="19"></td>

              <td width="18%" height="19"><?=$lang_merchant_currency?> </td>
              <td width="1%" height="19"><select name="merchant_currency">
                    <?
                    # POPULATE currency

                    if(mysql_num_rows($crnyret)>0){
                      while($crnyrow = mysql_fetch_object($crnyret))
                      {
                      ?><option value="<?=$crnyrow->currency_caption?>" <?=($crnyrow->currency_id==$merchant_currency)?"selected='selected'":""?>><?=trim(stripslashes($crnyrow->currency_caption))?></option><?
                      }
                    }

                    ?>
              </select>&nbsp;</td>
            </tr>
            <tr>
              <td height="9"  colspan="6">&nbsp;</td>
            </tr>

              <tr>
              <td height="9"  colspan="6">
                <table width="100%">
                <tr>
     <td height="20" bgcolor="#FFA200" align="center"><strong><?=$lang_terms_condn?></strong>
    </td>
  </tr>
  <tr>
    <td height="19">&nbsp;

    </td>
  </tr>
  <tr>
    <td height="19" align="center"><textarea name="termsCondn" cols="80" rows="5"><?=stripslashes($contents)?></textarea>
    </td>
  </tr>
  <tr>
    <td height="19">&nbsp;

    </td>
  </tr>
   <tr>
    <td height="19" align="center"><input name="terms" type="checkbox" value="1" /> <?=$lang_terms?>

    </td>
  </tr>
                </table></td>
            </tr>

            <tr>
              <td height="9"  colspan="6"><div align="center">
                <input type="submit" value="Register" name="B1"/>
              </div></td>
            </tr>
          </table>
          <p></p></td>
        </tr>
        <tr>
          <td height="26" colspan="2" bgcolor="#d2d2d2" class="lftborder">
            <div align="right"><img src="images/innerbox2_07.gif" width="25" height="26" alt=""/></div></td>
        </tr>
</table></form></td>
  </tr>
  <tr>
    <td width="215" height="23" align="left" valign="bottom" class="lftnavbg"><img src="images/lft_bt_13.gif" width="215" height="23" alt=""/></td>
  </tr>
</table>

<script language="javascript" type="text/javascript">
           function viewLink()
                {

                   url="forgotpass.php";
                   nw = open(url,'new','height=200,width=450,scrollbars=yes');
                   nw.focus();
                }
 </script>